/**
 * 
 */
package sg.edu.nus.iss.team8s.vmcs.builder;

import java.awt.Button;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Label;
import java.awt.Panel;

import sg.edu.nus.iss.team8s.vmcs.beans.DrinksBrand;
import sg.edu.nus.iss.team8s.vmcs.beans.StoreItem;
import sg.edu.nus.iss.team8s.vmcs.cache.DrinksStore;
import sg.edu.nus.iss.team8s.vmcs.commons.Constant;

/**
 * @author Wang Shi Jie
 *
 */
public class CustomerPanel extends Panel {
	private Button fiveCent;
	private Button tenCent;
	private Button twentyCent;
	private Button fiftyCent;
	private Button oneDollar;
	private Button invalid;
	
	private Label invalidCoin;
	private Label totalMoneyValue;
	
	private Button[] brands;
	private Label[] prices;
	private Label[] status;
	
	private Label changeStatus;
	
	private Button terminate;
	
	private Label collectCoinValue;
	private Label collectCanValue;
	
	private Panel titlePanel;
	private Panel inputPanel;
	private Panel displayPanel;
	private Panel statusPanel;
	
	public void refreshDrinksInventory(int index){
		/*
		 * when the drink item is replenished and the price of drink is changed, the UI need to
		 * be refreshed with the new price and stock status
		 * index = -1, refresh all the drink items
		 */
		
		if(index == -1){
			//refresh all drink items
			DrinksStore drinksStore = DrinksStore.getInstance();
			for(int id=0; id<drinksStore.getStoreSize();id++){
				StoreItem drink = drinksStore.getItem(id);
				int qty = drink.getQuantity();
				/*
				 * To do: refresh the stock status accordingly
				 */
				DrinksBrand brand = (DrinksBrand)drink.getContent();
				int price = brand.getPrice(); //price in cents
				/*
				 * To do: update the price label accordingly
				 */
			}
			
			
		}
		else{
			//refresh the drink item[index] only
		}
		
	}
	
	public CustomerPanel(){
		FlowLayout layout = new FlowLayout();
		layout.setVgap(0);
		this.setLayout(layout);
		this.setPreferredSize(new Dimension(Constant.PANEL_WIDTH, 600));
	}
	
	public Button getFiveCent() {
		return fiveCent;
	}
	public void setFiveCent(Button fiveCent) {
		this.fiveCent = fiveCent;
	}
	public Button getTenCent() {
		return tenCent;
	}
	public void setTenCent(Button tenCent) {
		this.tenCent = tenCent;
	}
	public Button getTwentyCent() {
		return twentyCent;
	}
	public void setTwentyCent(Button twentyCent) {
		this.twentyCent = twentyCent;
	}
	public Button getFiftyCent() {
		return fiftyCent;
	}
	public void setFiftyCent(Button fiftyCent) {
		this.fiftyCent = fiftyCent;
	}
	public Button getOneDollar() {
		return oneDollar;
	}
	public void setOneDollar(Button oneDollar) {
		this.oneDollar = oneDollar;
	}
	public Button getInvalid() {
		return invalid;
	}
	public void setInvalid(Button invalid) {
		this.invalid = invalid;
	}
	public Label getInvalidCoin() {
		return invalidCoin;
	}
	public void setInvalidCoin(Label invalidCoin) {
		this.invalidCoin = invalidCoin;
	}
	public Label getTotalMoneyValue() {
		return totalMoneyValue;
	}
	public void setTotalMoneyValue(Label totalMoneyValue) {
		this.totalMoneyValue = totalMoneyValue;
	}
	public Label[] getPrices() {
		return prices;
	}
	public void setPrices(Label[] prices) {
		this.prices = prices;
	}
	public Label[] getStatus() {
		return status;
	}
	public void setStatus(Label[] status) {
		this.status = status;
	}
	public Label getChangeStatus() {
		return changeStatus;
	}
	public void setChangeStatus(Label changeStatus) {
		this.changeStatus = changeStatus;
	}
	public Button getTerminate() {
		return terminate;
	}
	public void setTerminate(Button terminate) {
		this.terminate = terminate;
	}
	public Label getCollectCoinValue() {
		return collectCoinValue;
	}
	public void setCollectCoinValue(Label collectCoinValue) {
		this.collectCoinValue = collectCoinValue;
	}
	public Label getCollectCanValue() {
		return collectCanValue;
	}
	public void setCollectCanValue(Label collectCanValue) {
		this.collectCanValue = collectCanValue;
	}
	public Panel getTitlePanel() {
		return titlePanel;
	}
	public Panel getInputPanel() {
		return inputPanel;
	}
	public Panel getDisplayPanel() {
		return displayPanel;
	}
	public Panel getStatusPanel() {
		return statusPanel;
	}
	public void setTitlePanel(Panel titlePanel) {
		this.titlePanel = titlePanel;
	}
	public void setInputPanel(Panel inputPanel) {
		this.inputPanel = inputPanel;
	}
	public void setDisplayPanel(Panel displayPanel) {
		this.displayPanel = displayPanel;
	}
	public void setStatusPanel(Panel statusPanel) {
		this.statusPanel = statusPanel;
	}
	public Button[] getBrands() {
		return brands;
	}
	public void setBrands(Button[] brands) {
		this.brands = brands;
	}	
}
